#include "scriptitem.h"
#include <QUuid>

ScriptItem::ScriptItem(const QString& sName,QObject *parent) : QObject(parent)
{
    msName = sName;
    mdStartTime = 0.0;
    mdEndTime = 0.0;

    this->setObjectName(QString("Script:%1:%2:%3").arg(parent->objectName().section(":",-1,-1)).arg(sName).arg(QUuid::createUuid().toString().section("-",1,1)));
}

QString ScriptItem::getName()
{
return msName;
}


void ScriptItem::setValue(ScriptItem::PosType type, double value)
{
    switch(type)
    {
    case ScriptItem::Time_Start:
    {
        mdStartTime = value;
    }
    case ScriptItem::Time_End:
    {
        mdEndTime = value;
    }
    default:
        break;
    }
}

double ScriptItem::getValue(ScriptItem::PosType type)
{
    switch(type)
    {
    case ScriptItem::Time_Start:
    {
        return mdStartTime;
    }
    case ScriptItem::Time_End:
    {
        return mdEndTime;
    }
    default:
        break;
    }

    return 0.0;
}
